package com.xinqi.modules.sys.gpt.controller.web;

import com.xinqi.common.base.response.PageInfo;
import com.xinqi.common.base.response.R;
import com.xinqi.common.satoken.utils.LoginHelper;
import com.xinqi.modules.sys.gpt.dto.req.ShareLogQueryDTO;
import com.xinqi.modules.sys.gpt.dto.rsp.ShareLogResultDTO;
import com.xinqi.modules.sys.gpt.service.ShareLogService;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springdoc.api.annotations.ParameterObject;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * WEB -- 用户分享注册记录
 *
 * @author: yyzhen
 * @date: 2023/05/23
 */
@Validated
@RestController
@RequestMapping("/web/share-log")
@RequiredArgsConstructor
public class ShareLogWebController {
    private final ShareLogService shareLogService;

    @Operation(summary = "用户分享注册记录-分页")
    @GetMapping("/page")
    public R<PageInfo<ShareLogResultDTO>> page(@ParameterObject ShareLogQueryDTO dto) {
        dto.setOperationUserId(LoginHelper.getUserId());
        PageInfo<ShareLogResultDTO> page = shareLogService.page(dto, dto);
        return R.data(page);
    }
}
